const TOKEN_KEY = 'xy-admin-token-2005';
const USER_INFO_KEY = 'xy-admin-userinfo-2005';
//保存 token
export function setToken(token){
  window.localStorage.setItem(TOKEN_KEY,token)
}
//提取token
export function getToken(){
 return window.localStorage.getItem(TOKEN_KEY)
}
//删除token
export function delToken(){
  window.localStorage.removeItem(TOKEN_KEY)
}
//保存用户信息
export function setUserInfo(userinfo){
  window.localStorage.setItem(USER_INFO_KEY,JSON.stringify(userinfo))
}
//获取用户信息
export function getUserInfo(){
  var userInfo = window.localStorage.getItem(USER_INFO_KEY)
  if (userInfo !== "" && userInfo !== undefined){
    return JSON.parse(userInfo)
  }
 return  null
}
//删除用户信息
export function delUserInfo(){
  window.localStorage.removeItem(USER_INFO_KEY)
}
//删除所有的信息
export function allInfo(){
delToken()
  delUserInfo()
}
